<!doctype html>
<html lang="en">

<head>
  <meta charset="utf-8">
  <title>测评系统</title>
  <base href="/">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="icon" type="image/x-icon" href="favicon.ico">
  <script
    src="assets/js/wxLogin.js"
  ></script>
  <script type="text/javascript" src="https://developer.baidu.com/map/custom/stylelist.js"></script>
  <script>
    var _hmt = _hmt || [];
    (function() {
      var hm = document.createElement("script");
      hm.src = "https://hm.baidu.com/hm.js?14a1f187b01de97105c859cdf3811f50";
      var s = document.getElementsByTagName("script")[0];
      s.parentNode.insertBefore(hm, s);
    })();
  </script>
</head>

<body>
  <app-root></app-root>
  <script type="text/javascript">
    // 微信登录
    function wxLoad() {
      let domain = document.domain;
      let appid = getAppid(domain);
      WxLogin({
        self_redirect:true,
        id:"divpage2",
        appid: appid,
        scope: "snsapi_login",
        // redirect_uri: encodeURIComponent('http://m.leandc.cn/api/bas/wx/auth'), // 授权成功后回调的url
        redirect_uri: encodeURIComponent(`https://${domain}/wx/wxRedirect.html`), // 授权成功后回调的url
        // state: "",
        // style: "",
        href: "https://leanct.abrainos.com/wx/css/loginimg.css"
      });
    }

    // 微信绑定
    function wxBind() {
      let domain = document.domain;
      let appid = getAppid(domain);
      WxLogin({
        self_redirect:true,
        id:"divwxbind",
        appid: appid,
        scope: "snsapi_login",
        // redirect_uri: encodeURIComponent('http://m.leandc.cn/api/bas/wx/auth'), // 授权成功后回调的url
        redirect_uri: encodeURIComponent(`https://${domain}/wx/wxBind.html`), // 授权成功后回调的url
        // state: "",
        // style: "",
        href: "https://leanct.abrainos.com/wx/css/loginimg.css"
      });
    }

    // 根据域名获取appid，默认为正式环境
    function getAppid(domain) {
      // 默认正式环境
      let appid = 'wxc3daf2eaf0fd5938';

      if (domain == 'test.abrainos.com') {
        appid = 'wxa63a01dc4188273f';
      }

      return appid;
    }
  </script>
</body>

</html>
